package cn.tedu.csmall.product.util;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Random;

public class IdUtils {

    private IdUtils(){
        
    }

    private static DateTimeFormatter dateTimeFormatter
            =DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS");
    private static Random random=new Random();

    public static Long  getId(){
        LocalDateTime now=LocalDateTime.now();
        System.out.println("当前时间："+now);
        String format = dateTimeFormatter.format(now);
        System.out.println("格式化后的时间："+format);
        int i=random.nextInt(89)+ 10;
        Long dateTimeValue = Long.valueOf(format+i);
        return dateTimeValue;
    }
}
